home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 9
/
Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO
/
050a
/
kwsrc120.zip
/
KWS.DOC
next >
Wrap
Text File
|
1993-01-22
|
14KB
|
347 lines
KWS V1.20 Copyright (c) 1991-1993 Copy Con Incorporated Page 1
DESCRIPTION
-----------
KWS (KeyWord Search) is a small, fast program that performs logical
AND/OR/NOT searches for keywords within one or more text files. Output
can be displayed onscreen, or sent to any output device via standard
DOS redirection. KWS excels in searching BBS file lists, and works
equally as well with other types of text files. This flexible program
also has options for 'fuzzy' searches, case, filters, pipes, line
numbering, on-screen pause, subdirectory searches, totals, and more.
REQUIREMENTS
------------
Hardware: Any PC compatible. Software: DOS 2.0 or higher.
DISCLAIMER
----------
KWS is distributed on an "AS IS" basis without warranty, expressed or
implied. Considerable testing effort has been expended, but the user
is advised to check the program's suitability before relying on it.
The user assumes full risk as to the results of using this program. In
no event shall the author be liable for any incidental or
consequential damages arising from the use, or inability to use this
program.
REGISTRATION
------------
The unregistered version of KWS is freely distributable and fully
functional, and may be used for a 30-day trial period. If you plan to
continue using KWS, you are obligated to pay the modest registration
fee of $20. Registered users will receive an individually serialized
nag-free version of KWS, a free upgrade, and $5 subsequent upgrades.
All registration information is contained in the KWS.REG file. If that
file is missing, register by sending your name and address (please
print), and a check or money order for $20 to:
Copy Con Incorporated
PO Box 23255
Baltimore MD 21203-5255
Please specify 3.5" or 5.25" diskette. MD residents add 5% sales tax.
Thank you for supporting Shareware.
KWS V1.20 Copyright (c) 1991-1993 Copy Con Incorporated Page 2
OPERATION
---------
KWS is activated from the command line, using the format
KWS [@]filename search_string[...] [options]
Parameters surrounded by [brackets] are optional.
The @ symbol, if used, must be directly followed by the name of a text
file containing valid filespecs; the files to be searched will be read
from that file list. (File lists can be created with KWS using the /M
option; see OPTIONS.)
If the @ symbol is not used, the filename is the filespec to be
searched. Wildcards are optional. (For a description of wildcards and
filespecs, see your DOS manual.)
Each search string is comprised of keywords separated by semicolons.
At least one keyword from each search string must be present in a
given line for it to be displayed; for example,
KWS allfiles.lst fixed;hard disk;drive
will display the lines in file ALLFILES.LST that contain either words
FIXED or HARD (or both), and also contain either words DISK or DRIVE.
If a search string contains a keyword with embedded spaces, the entire
search string must be enclosed in quotes; for example,
KWS temp.bat "del *;era *"
will search TEMP.BAT for the phrase "del *" or "era *" (without the
quotes).
A logical 'NOT' search can be conducted by preceding a keyword with
an exclamation (!) character; for example,
KWS stuff.txt this !that
will display the lines in STUFF.TXT that contain the word THIS and not
the word THAT. If you wish to search for an exclamation as the first
(or only) character of a keyword, use two in a row; for example,
KWS stuff.txt this !!that
will display lines that contain both words THIS and !THAT. Exclamation
characters inside or following keywords (as in " HEY! " or " What!? ")
do not have to be doubled.
A fuzzy search can be conducted by preceding a keyword with a tilde
(~) character; lines with words that are similar to the keyword will
be displayed. This option is useful if you aren't sure of a keyword's
correct spelling, or if a keyword may be spelled incorrectly in the
files to be searched. for example,
KWS V1.20 Copyright (c) 1991-1993 Copy Con Incorporated Page 3
OPERATION (continued)
---------------------
KWS gnu.txt ~copyrite
will display lines with words similar to COPYRITE. (The similarity
percentage can be adjusted with the /F option; see OPTIONS.) If you
wish to combine a fuzzy search with a logical 'NOT' search, use the
'NOT' character before the tilde (as in " !~THE "). Fuzzy searches
cannot be combined with prefix/suffix/whole word searches (described
below).
Whole word searches can be conducted by putting underscore (_)
characters before and after the keyword; for example,
KWS files.lst _c_ source
will display lines in FILES.LST that contain a lone 'C' and the word
SOURCE. Similarly, prefixes can be searched for by putting an
underscore before a keyword, and suffixes can be searched for by
putting an underscore after a keyword. If you wish to search for an
underscore as the first or last (or only) character of a keyword, use
two underscores in a row, as with the logical 'NOT' exclamation
character above. If you wish to combine a prefix/whole word search
with a logical 'NOT' search, use the 'NOT' character before the
underscore (as in " !_c_ "). Prefix/suffix/whole word searches cannot
be combined with fuzzy searches (described above).
Up to 10 search strings are allowed, with up to 10 keywords per
string.
OPTIONS
-------
Options can appear anywhere on the command line after the filename.
They can be in any order, and are not case-sensitive. Options can be
separated by spaces (/L3 /P /T) or strung together (/L3/P/T or /L3PT).
Option Description
/B This option makes the keywords stand out from the rest of the
displayed line. Output cannot be redirected when using this
option.
/C Search will be case-sensitive.
/E The command line will be echoed as the first output line.
Useful mainly with redirected files to avoid repetition, and
for testing batch files.
/Fn This option controls the similarity percentage for fuzzy
searches. Similarity defaults to 65 percent, and can be
adjusted from 0 (display almost every line) to 100 (display
exact matches).
KWS V1.20 Copyright (c) 1991-1993 Copy Con Incorporated Page 4
OPTIONS (continued)
-------------------
/H Hidden and/or system files will also be searched.
/Kc Change the keyword separator charactor from a semicolon to
the specified character. This option may be needed to pass
multiple keyword parameters to a batch file, as some versions
of DOS remove semicolons from batch parameters.
/L[n] Line numbers will be displayed with output. If no width is
specified, the numbers will be left-justified, with a colon
between the number and the text; otherwise, the numbers will
be right-justified and zero-padded to the left, followed by
the colon and text. If the specified width is too small for a
number to fit, the number will NOT be truncated.
/M[n] Stop searching after n matches per file. /M alone will cause
KWS to print only the filenames of successful searches, and
they can be redirected to a file to be used as a file list.
/P Pause between each screen of text. KWS will autodetect your
screen size, and pause accordingly. This option should not be
used if redirecting output or if using the /R option.
/R Instead of reading from text files, KWS will act as a filter
or pipe (input is taken from an input device or from another
program's output). When in this mode, the /P option will be
inactive. Do not specify a filename when using this option.
/S Subdirectories will also be searched. This option is valid
only with wildcard and file list searches.
/T Display total lines found per file. For wildcard and file
list searches, a grand total will also be displayed.
EXAMPLES
--------
KWS catalog.lst dvorak keyboard /p
will take the lines in file CATALOG.LST that contain the words
DVORAK and KEYBOARD, and display them one screen at a time.
KWS catalog.lst arc;lzh shell /l5 >prn
will take the lines in file CATALOG.LST that contain either ARC or
LZH, and also contain SHELL, and send them to the printer, along
with their line numbers.
KWS allfiles.lst /c !.ZIP >nozip.lst
will make a file called NOZIP.LST, which will contain all of the
lines in ALLFILES.LST that do NOT contain the word .ZIP in caps.
KWS V1.20 Copyright (c) 1991-1993 Copy Con Incorporated Page 5
EXAMPLES (continued)
--------------------
KWS \dl\*.lst MIDI /ptc
will search all .LST files in the DL directory for the word MIDI in
capital letters, and displays the filenames and lines onscreen, one
screen at a time, with totals for each file.
KWS *.bak _the_
will search the backup files for lines that contain the word THE,
but will not display them if THE is part of another word (as in
THESIS or OTHER).
KWS temp.bak _the_;!_the_ /b
will display every line in TEMP.BAK, hilighting any occurrance of
the word THE.
KWS wp.txt _in /p
searches file WP.TXT for words beginning with IN, pausing at each
screen.
KWS c:\*.bat _del;_era /s/h
will search all of the batch files on the C: drive, including those
with their hidden and/or system attributes set, to see if any of
them delete/erase files.
KWS this;that /r <con >prn
reads input from the CON device (the keyboard), filters out lines
that do not contain words THIS or THAT, and sends the rest to the
PRN device (the printer, most likely), until Ctrl-Break is pressed.
dir | KWS -92 /r
pipes the output from the DIR command into KWS, which will display
the directory entries from 1992.
KWS ; /r /l3 <one.txt >two.txt
creates file TWO.TXT which is a duplicate of file ONE.TXT, except
that it has 3-digit line numbers. (A search for the keyword
separator will find every line.)
KWS *.doc ~copyrite /f70b
will search the .DOC files for words similar to COPYRITE, hilighting
any close calls.
KWS *.doc ~copyrite !1993 /f70b
will display the same lines as the above example, except for lines
containing the word 1993.
KWS allfiles.lst _c_;assem;asm src;source /pb
will display all lines in ALLFILES.LST that have to do with C or
assembler source code. Keywords will be in bold, and output will be
paused after each screen.
KWS allfiles.lst _c_;assem;asm src;source !c++ /pb
will display the same as above, except C++ files will not be shown.
KWS V1.20 Copyright (c) 1991-1993 Copy Con Incorporated Page 6
EXAMPLES (continued)
--------------------
KWS c:\*.bat ; /sm >filelist.txt
will create a file named FILELIST.TXT containing the names of all of
the batch files on the C: drive. This file is used in the next
example.
KWS @filelist.txt label "if %;goto"
will search the filenames in FILELIST.TXT, and display lines in
those files that contain the word LABEL and either the word GOTO or
the phrase "IF %" (without the quotes). Note that this example has
only two search strings, not three; if any words in a search string
contain spaces, then the entire search string must be in quotes.
RETURN CODES
------------
The DOS errorlevel will be set if a search is unsuccessful:
Level Description
1 Invalid command line options
2 None of the files contain the search string(s)
3 Ctrl-Break interrupt
4 Invalid directory specified
5 No files match filespec
SUPPORT
-------
If you have questions, comments, suggestions, bug reports, et cetera,
feel free to contact me by one of the following methods:
1: By modem at The Programmer's Corner (301-596-7692 or 410-995-6873).
Send a message to RD Thomas in the Shareware or General conference,
and check back in a couple of days for a reply.
2: By modem in the RIME Shareware conference (RD Thomas ->1520). Allow
at least one week for a reply.
3: By US Mail at the address given on the first page. If you would
like a reply, please include a self-addressed, stamped envelope.
Looking forward to hearing from you.
This document can be printed by typing "copy kws.doc LPTx" at the DOS
prompt, where x is the number of the printer port to be used.